{% extends "base.html" %}
{% block title%}API列表{% endblock%}
{% block content %}
	<ol class="breadcrumb">
  		<li><a href="/autotester/projects">项目</a></li>
  		<li><a href="/autotester/project?id={{module.project.id}}">{{ module.project.name }}</a></li>
  		<li class="active">{{ module.name }}(该模块由<a href="javascript:;" class="profile">{{module.created_user.username}}</a>于{{module.created_time|date:"Y年m月d日 H:i:s"}}添加)</li>
	</ol>
	<div class="row">
        {% if perms.script.add_api%}
		<div ><a class="btn btn-primary pull-right" href="/autotester/api/create?mid={{module.id}}">+添加API</a></div>
        {% endif %}
		<table class="table table-striped table-hover table-condensed">
			<thead>
				<tr>
					<th>ID</th>
					<th>名称</th>
					<th>URL</th>
					<th>请求方式</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				{% for api in apis%}
					<tr>
						<td>{{ api.id }}</td>
						<td><a href="/autotester/cases?aid={{api.id}}">{{ api.name }}</a></td>
						<td>{{ api.url }}</td>
						<td>{{ api.method }}</td>
                        <td>
                        {% if api.status %}
                        {% if perms.script.change_api%}
                        <<a class="btn" href="/autotester/api/active?id={{api.id}}" data-toggle="tooltip" data-placement="right" title="激活"><span class="glyphicon glyphicon-pushpin"></span></a>
                        {% endif%}
                        {% else %}
						
                            <a class="btn" href="/autotester/cases?aid={{api.id}}" data-toggle="tooltip" data-placement="bottom" title="查看case"><span class="glyphicon glyphicon-eye-open"></span></a>
                            {% if perms.script.change_api%}
                            <a class="btn" href="/autotester/api/edit?id={{api.id}}" data-toggle="tooltip" data-placement="bottom" title="编辑"><span class="glyphicon glyphicon-edit"></span></a>
                            <a class="btn" href="/autotester/api/inactive?id={{api.id}}" data-toggle="tooltip" data-placement="bottom" title="禁用"><span class="glyphicon glyphicon-trash"></span></a>
                            {% endif %}
                            <a class="btn" href="/autotester/cases/test?aid={{api.id}}" data-toggle="tooltip" data-placement="bottom" title="Run Test"><span class="glyphicon glyphicon-flash"></span></a>
                            <a class="btn" href="/autotester/api/report?aid={{api.id}}" data-toggle="tooltip" data-placement="right" title="查看报告"><span class="glyphicon glyphicon-list-alt"></span></a> 
                            
                                                   
                        {% endif %}
                        </td>                        
                    </tr>
				{% endfor %}
			</tbody>
		</table>
	</div>
{% endblock %}